<?php
$db=new PDO('mysql:host=localhost','root','12qwas');
$r=$db->exec('create database if not exists db3');
//var_dump($r);
$r=$db->exec('use db3');
//var_dump($r);
$r=$db->exec('create table if not exists students(xh varchar(9) primary key, name varchar(50),age int default 0)');
//var_dump($r);
$r=$db->exec("delete from students where xh='233110101'");
$db->exec('truncate table students');//删除所有数据
$r=$db->exec("insert into students(xh,name,age) values('233110101','张三',18),
                                        ('233110102','李四',20),('233110103','王五',18)");
$r=$db->exec("update students set name='张三丰' where xh='233110201'");
var_dump($r);